# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
from cerbero.utils import shell


class Recipe(recipe.Recipe):
    name = 'soundtouch'
    version = '1.9.2'
    stype = SourceType.TARBALL
    url = 'http://www.surina.net/soundtouch/soundtouch-1.9.2.tar.gz'
    tarball_dirname = 'soundtouch'
    licenses = [License.LGPLv2_1Plus]
    autoreconf_sh = './bootstrap'
    autoreconf = True

    patches = ['soundtouch/0001-Add-dummy-file-to-make-sure-config-m4-exists.patch',
               'soundtouch/0002-Use-STLPORT-on-Android.patch',
               'soundtouch/0003-Don-t-build-soundstretch.patch',
               'soundtouch/0004-Use-gnustl.patch',
               'soundtouch/0005-Fix-soundstretch-linking.patch',
               'soundtouch/0006-Fix-pkg-config-file.patch',
               'soundtouch/0007-Make-it-compile-on-IOS.patch',
               'soundtouch/0008-Fix-compilation-with-clang.patch',
               'soundtouch/0010-Try-harder-to-generate-Win32-DLLs.patch']

    files_libs = ['libSoundTouch']
    files_devel = ['include/soundtouch', 'lib/pkgconfig/soundtouch.pc']

    def prepare (self):
      self.configure_options += ' --enable-static '
      if self.config.target_platform == Platform.ANDROID:
        self.configure_options += ' --with-gnustl '
        self.append_env['CXXFLAGS'] = " -fexceptions "
      elif self.config.target_platform == Platform.IOS:
        self.autoreconf = True
